/*************************************************
Author: byron 
Date: 08/15/2013
Description:
Notes:
*************************************************/

#ifndef __CDayWishMgr_h__
#define __CDayWishMgr_h__

#include "CDayWishCfg.h"

class CPlayerOnlineData;
class MsgReqDayWish;
class MsgAnsDayWish;

class CDayWishMgr
{
public:
    enum CMD_DAY_WISH_SUB_TAG
    {
        CMD_DAY_WISH_SUB_GET_INFO = 1,        //获取信息
        CMD_DAY_WISH_SUB_DAY_WISH = 2,        //每日许愿
        CMD_DAY_WISH_SUB_GET_AWARD = 3,       //领取奖励

        CMD_DAY_WISH_SUB_NOTIFY_INFO = 101,   //主动下发信息
    };

    enum ENM_DAY_WISH_MACRO_TAG
    {
        DAY_WISH_MACRO_WISH_TIMES = 3,  //每日许愿次数上限
        DAY_WISH_MACRO_BIT_SET_ONE = 0, //每日许愿位设置第一位表示第一个许愿
        DAY_WISH_MACRO_BIT_SET_TWO = 1, //每日许愿位设置第二位表示第二个许愿
        DAY_WISH_MACRO_BIT_SET_THR = 2, //每日许愿位设置第三位表示奖励领取
        DAY_WISH_MACRO_WISH_ICON_ONE = 1, //每日许愿表示第一个许愿
        DAY_WISH_MACRO_WISH_ICON_TWO = 2, //每日许愿表示第二个许愿
    };

    CDayWishMgr()
    {
        _stDayWishCfg.Clear();
    }

    virtual ~CDayWishMgr()
    {
    }

    CDayWishCfg& GetDayWishCfg(){return _stDayWishCfg;}

    int FindConfig(int iID)
    {
        return _stDayWishCfg.FindConfig(iID);
    }

    CDayWishCfgData& GetConfig(int iIndex)
    {
        return _stDayWishCfg.GetConfig(iIndex);
    }

    int GetDayWishInfo(CPlayerDetailInfoEx1& stPlayerDetailEx1,
            MsgAnsDayWish& stAns);

    int UpdateDayWishItem(CPlayerDetailInfoEx1& stPlayerDetailEx1);

    bool IsWishItemNeedUpdate(CDayWishItem& stWishItem);

    int PlayerWish(CPlayerDetailInfoEx1& stPlayerDetailEx1,
            MsgReqDayWish& stReq, MsgAnsDayWish& stAns);

    int GetAward(CPlayerDetailInfoEx1& stPlayerDetailEx1,
            CPlayerOnlineData& stPlayerOnline, MsgReqDayWish& stReq,
            MsgAnsDayWish& stAns);

    int NotifyAllOnlineUsers();

private:
    CDayWishCfg _stDayWishCfg;
};

#endif //__CDayWishMgr_h__

